package com.x.Part9_继承;

import java.awt.print.Printable;

/**
 * ClassName: Kid
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.02.27 20:51
 */
public class Kid extends ManKind{
    private int age;

    public Kid(){}

    public Kid(int age) {
        this.age = age;
    }

    public Kid(int age, int salary, int sex){
        this.age = age;
        //先不使用super()
        setSex(sex);
        setSalary(salary);
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void printAge(){
        System.out.println("孩子年龄为："+getAge()+"岁");
    }
    @Override
    public void workOrRest(){
        super.workOrRest();
        System.out.println("孩子不应该工作");
    }
}
